import { createPinia } from "pinia";
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import { defineStore } from "pinia";
// pinia persist
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate);
// stores/index.js
export const useStore = defineStore("user", {
  state: () => ({
    token: null // 用于存储用户 token
  }),
  actions: {
    // 用于设置 token
    setToken(newToken: any) {
      this.token = newToken;
    }
  }
});

export default pinia;
